package com.kly.smartbi.test.day06;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.Scanner;

/**
 * @author admin
 * @date 2025/4/8
 */
public class Demo {
    public static void main(String[] args) {
        String string = Integer.toString(10, 7);
        System.out.println(string);

    }

    /**
     * 求和
     */
    public static void getSum() {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        BigInteger num = new BigInteger("0");
        for(long i = 1; i <= 20230408; i++ ){
            num = num.add(BigInteger.valueOf(i));
        }
        System.out.println(num);
        scan.close();
    }

    /**
     * 特殊日期
     */
    public static void specialDate() {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        LocalDate begin = LocalDate.of(1900, 1, 1);
        LocalDate end = LocalDate.of(9999, 12, 31);
        int count = 0;
        while(!begin.isEqual(end)) {
            int y1 = begin.getYear() % 10;
            int y2 = begin.getYear() / 10 % 10;
            int y3 = begin.getYear() / 100 % 10;
            int y4 = begin.getYear() / 1000;
            int year = y1 + y2 + y3 + y4;
            int m1 = begin.getMonthValue() % 10;
            int m2 = begin.getMonthValue() / 10;
            int month = m1 + m2;
            int d1 = begin.getDayOfMonth() % 10;
            int d2 = begin.getDayOfMonth() / 10;
            int day = d1 + d2;
            if(year == month + day) {
                count++;
            }
            begin = begin.plusDays(1);
        }
        System.out.println(count);
        scan.close();
    }

    /**
     * R格式
     */
    public static void rFormat() {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int a = scan.nextInt();
        BigDecimal bigDecimal = scan.nextBigDecimal();
        BigDecimal decimal = new BigDecimal("2");
        BigDecimal res = decimal.pow(a).multiply(bigDecimal)
                .setScale(0, RoundingMode.HALF_UP);
        System.out.println(res);
    }
}
